<?php

class Zendhlt_View_Helper_UploadElement extends Zend_View_Helper_FormElement {

	protected $html = '';

	public function uploadElement($name, $value = null, $attribs = null) {
		$filename = '';
		if (!empty($value))
			$filename = $value;

		$helperButton = new Zend_View_Helper_FormButton();
		$helperButton->setView($this->view);
		$helperText = new Zend_View_Helper_FormText();
		$helperText->setView($this->view);
		$helperHidden = new Zend_View_Helper_FormHidden();
		$helperHidden->setView($this->view);
		$this->html .= "<img id='thumbnail' class='images-upload' src='' />";
		$this->html .= $helperHidden->formHidden('hidden_' . $name, $filename);
		$this->html .= $helperText->formText($name, $filename, array('id' => $name, 'class' => 'imageurl', 'disable' => 'true'));
		$this->html .= $helperButton->formButton('inputupload', 'Chọn hình ảnh', null);
		return $this->html;
	}
}

